#ifndef CARDPANEL_H
#define CARDPANEL_H

#include <QWidget>
#include <card.h>
#include <player.h>
#include <qhash.h>
class CardPanel : public QWidget
{
    Q_OBJECT
public:
    explicit CardPanel(QWidget *parent = nullptr);
//设置获取图片格式
    void setImage(QPixmap &front,QPixmap &back);
    QPixmap getImage();
    //扑克显示的一面
    void  setFrontSide(bool flag);
    bool  getFrontSide();
    //扑克是否被选中
    void  setSelected(bool flag);
    bool  getSelected();
    //扑克牌的花色点数
    void  setCard(Card card);
    Card  getCard();
    //扑克牌的所有者
    void  setOwner(Player* player);
    Player*  getOwner();
    // 模拟扑克牌的点击事件
    void clicked();
protected:
    void paintEvent(QPaintEvent *event);
    void mousePressEvent(QMouseEvent* event);
signals:
    void cardSelected(Qt::MouseButton button);

private:
    QPixmap m_front;
    QPixmap m_back;
    bool m_isfront = true;
    bool m_isSelect = true;
    Card m_card;
    Player* m_owner = nullptr;
};

#endif // CARDPANEL_H
